// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.modules.dao.impl;

import com.liuxinlong.modules.dao.AssetsOrderDetailDao;
import com.liuxinlong.modules.entity.AssetsOrderDetail;
import com.liuxinlong.modules.mapper.AssetsOrderDetailMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * AssetsOrderDetailDaoImpl
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2024年02月02日
 */
@Service
public class AssetsOrderDetailDaoImpl extends ServiceImpl<AssetsOrderDetailMapper, AssetsOrderDetail> implements AssetsOrderDetailDao {

    @Override
    public List<AssetsOrderDetail> pageAssetsOrderDetailInfo(Map<String, Object> queryParam) {
        return baseMapper.pageAssetsOrderDetailInfo(queryParam);
    }

    @Override
    public int getAssetsOrderDetailInfoCount(Map<String, Object> queryParam) {
        return baseMapper.getAssetsOrderDetailInfoCount(queryParam);
    }

    @Override
    public List<AssetsOrderDetail> getAssetsOrderDetailList(Map<String, Object> queryParam) {
        return baseMapper.getAssetsOrderDetailList(queryParam);
    }

    @Override
    public Map<String, AssetsOrderDetail> getAssetsOrderDetailMap() {
        Map<String, Object> queryParam = new HashMap<>();
        queryParam.put("startNum", 0);
        queryParam.put("pageSize", 100000);
        List<AssetsOrderDetail> originalList = baseMapper.pageAssetsOrderDetailInfo(queryParam);
        Map<String, AssetsOrderDetail> orderMap = new HashMap<>(originalList.size());
        for (AssetsOrderDetail orderDetail : originalList) {
            orderMap.put(orderDetail.getOrderNo() + "-" + orderDetail.getLineNumber(), orderDetail);
        }
        return orderMap;
    }

    @Override
    public List<AssetsOrderDetail> getDetailListByOrderId(List<String> orderList) {
        return baseMapper.getDetailListByOrderId(orderList);
    }

}
